<template>
  <view>
    <u-form-item label="VIN">
      <view class="u-flex" style="flex: 1">
        <u--input
          placeholder="请输入内容"
          v-model="vin"
          border="none"
        ></u--input>
        <text class="iconfont icon-saoyisao" @click="getvin"></text>
      </view>
    </u-form-item>
  </view>
</template>
<script>
  export default {
    props: {
      value: {
        type: String,
        default: "",
      },
    },
    data() {
      return {
        vin: "",
      };
    },
    watch: {
      vin(val) {
        this.$emit("input", val);
      },
      value(val) {
        this.vin = val;
      },
    },
    methods: {
      async getvin() {
        let vin = await this.$z.UploadGetVin();
        vin =
          vin.length == 1
            ? vin[0]
            : {
                VIN: "",
              };
        vin = vin.VIN;
        this.vin = vin;
      },
    },
  };
</script>
<style lang="scss">
  .icon-saoyisao {
    width: 80rpx;
    height: 80rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36rpx;
  }
</style>
